package com.computergames.server;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Service;

@Service
public class KafkaConsumer {
//    @KafkaListener(topics = "test", groupId = "try")
//    public void listen(ConsumerRecord<?, ?> record, Acknowledgment ack,
//                       @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) {
//        System.out.println("消费消息 " + record.topic()+"  "+record.partition()+" " + record.value());
//        ack.acknowledge();
//    }
}
